package com.java.demo.base;

public class InnerClassDemo {
    private static int outerStaticVal;

    private int outNum;

    public class InnerClass {
        // 内部内不能定义静态变量
        public int innerVal;

        public void innerMethod() {
            outNum = 0;
            outerStaticVal = 1;
        }
    }

    public static class InnerStaticClass {
        public static int innerStaticVal;
        public int innerVal;

        public void innerMethod() {
            outerStaticVal = 1;
        }
    }

    public void outMethod() {
        InnerClass innerClass = new InnerClass();
        innerClass.innerMethod();

        InnerStaticClass innerStaticClass = new InnerStaticClass();
        innerStaticClass.innerMethod();
        InnerStaticClass.innerStaticVal = 1;
    }
}
